package com.exam.controller;


import com.exam.pojo.CityDTO;
import com.exam.pojo.R;
import com.exam.pojo.YearDataVo;
import com.exam.service.CityService;
import lombok.extern.log4j.Log4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Log4j
@RestController
@RequestMapping(("/api/crime"))
public class CityController {
    @Resource
    private CityService cityService;

    @GetMapping("/stat")
    public R<List<YearDataVo>> getStat(){
        return R.ok(cityService.getStat());
    }

    @PostMapping
    public R addCrime(@RequestBody CityDTO cityDTO) {
        return R.ok(cityService.addCrime(cityDTO));
    }
}
